<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改背景颜色</title>
</head>

<body>


    <div>
        你好
    </div>


</body>

<script>
    var a = document.querySelector('div');
    a.onclick = function() {
        this.style.height = '100px';
        this.style.width = '100px';
        this.style.backgroundColor = 'red';

    }
</script>

</html>